<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
       
       function getNum(min,max){
          return Math.floor(Math.random() * (max - min + 1)) + min;
       }
      
       var random = getNum(1,1000);
       var n = 10;
       while(n--){
          var number = prompt('请输入1~1000之间的数字：');
          if(n==0){
             alert('不好意思哦，您的10次机会已用完！');
             break;  
          }
          if(number > random){
            alert('你猜的数过大!再猜一次吧!');
          }
          else if(number < random){
            alert('您猜的数过小!再猜一次吧!');
          }
          else{
            alert('恭喜您，猜对了！！！');
            break;
          }
         
       }
 
    </script>
</head>
<body>
    
</body>
</html>